package com.jysz.certificate.persistence.enums.mf;

/**
 * 发票状态
 * 
 * @author xuxiaolong
 */
public enum IndexBillStatus {

	APPLYED("已申请开票", 1),OPENED("已开票（未实收）", 2), PARTCHARGE(
			"已部分实收", 3), FULLCHARGE("已完全实收", 4), CANCELED("已注销", 5), INVALID(
			"已作废", 6), REDFONT("红字", 8);

	// 名称
	private String name;
	// 索引
	private int index;

	private IndexBillStatus(String name, int index) {
		this.name = name;
		this.index = index;
	}

	// 根据索引获得名称
	public static String getName(int index) {
		for (IndexBillStatus r : IndexBillStatus.values()) {
			if (r.getIndex() == index) {
				return r.name;
			}
		}
		return null;
	}

	public static IndexBillStatus index(int index) {
		for (IndexBillStatus r : IndexBillStatus.values()) {
			if (r.getIndex() == index) {
				return r;
			}
		}
		return null;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getIndex() {
		return index;
	}

	public void setIndex(int index) {
		this.index = index;
	}

}
